<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Link dialog window.
-->
<html>
<head>
	<title>Reference Properties</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex, nofollow" />
	<script type="text/javascript">

var oEditor		= window.parent.InnerDialogLoaded() ;
var FCK			= oEditor.FCK ;
var FCKLang		= oEditor.FCKLang ;
var FCKConfig	= oEditor.FCKConfig ;
var FCKRegexLib	= oEditor.FCKRegexLib ;
var FCKTools	= oEditor.FCKTools ;

document.write( '<script src="' + FCKConfig.BasePath + 'dialog/common/fck_dialog_common.js" type="text/javascript"><\/script>' ) ;

	</script>
	<script type="text/javascript">

// Get the selected flash embed (if available).
var oFakeImage = FCK.Selection.GetSelectedElement() ;
var oRef ;

if ( oFakeImage )
{
	if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fck_mw_ref') )
		oRef = FCK.GetRealElement( oFakeImage ) ;
	else
		oFakeImage = null ;
}

window.onload = function()
{
	// Translate the dialog box texts.
	oEditor.FCKLanguageManager.TranslatePage(document) ;

	// Load the selected link information (if any).
	LoadSelection() ;

	// Activate the "OK" button.
	window.parent.SetOkButton( true ) ;
	window.parent.SetAutoSize( true ) ;
	GetE('xRefText').focus();
}

function LoadSelection()
{
	if ( !oRef ) return ;

	GetE('xRefText').value = FCKTools.HTMLDecode( oRef.innerHTML ).replace( /&quot;/g, '"' ) ;
	GetE('xRefName').value = oRef.getAttribute( 'name' ) ;
}

//#### The OK button was hit.
function Ok()
{
	if ( !oRef )
	{
		oRef = FCK.EditorDocument.createElement( 'SPAN' ) ;
		oRef.className = 'fck_mw_ref' ;
	}

	var refData = FCKTools.HTMLEncode( GetE('xRefText').value ).Trim().replace( /"/g, '&quot;' ) ;
	oRef.innerHTML = refData ;
	SetAttribute( oRef, "name", GetE('xRefName').value ) ;

	if ( !oFakeImage )
	{
		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__MWRef', oRef ) ;
		oFakeImage.setAttribute( '_fck_mw_ref', 'true', 0 ) ;
		oFakeImage	= FCK.InsertElement( oFakeImage ) ;
	}

	return true ;
}

	</script>
</head>
<body style="overflow: hidden">
	<div id="divInfo">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
			<tr>
				<td>
					<span fcklang="wikiRef">Reference text (Wikitext)</span>
				</td>
			</tr>
			<tr>
				<td height="100%">
					<textarea id="xRefText" style="width: 100%; height: 100%; font-family: Monospace"
						cols="50" rows="5"></textarea>
				</td>
			</tr>
			<tr>
				<td>
					<span fcklang="wikiRefName">Reference name (optional)</span><br />
					<input id="xRefName" type="text" size="15" />
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
